<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */

namespace App\User\Service;

use App\User\Mapper\UserInfoMapper;
use Mine\Abstracts\AbstractService;
use Mine\MineModel;

/**
 * 用户信息表服务类
 */
class UserInfoService extends AbstractService
{
    /**
     * @var UserInfoMapper
     */
    public $mapper;

    public function __construct(UserInfoMapper $mapper)
    {
        $this->mapper = $mapper;
    }
    public function save(array $data): mixed
    {
        return $this->mapper->save($data);
    }

    public function resetPassword(mixed $id, array $data): bool
    {
        return $this->mapper->resetPassword($id, $data);
    }
    public function clearLoginIp(mixed $id, array $data): bool
    {
        return $this->mapper->clearLoginIp($id, $data);
    }
    public function updateParent(mixed $id, array $data): bool
    {
        return $this->mapper->updateParent($id, $data);
    }

    public function getPageList(?array $params = null, bool $isScope = true): array
    {
        if ($params['select'] ?? null) {
            $params['select'] = explode(',', $params['select']);
        }
        return $this->mapper->getPageList($params, $isScope);
    }
    public function read(mixed $id, array $column = ['*']): ?MineModel
    {
        return $this->mapper->read($id, $column);
    }
}